<template>
  <div class="set">
   <header-bar :text="title" :left="left"></header-bar>
<div class="set_content">
<div class="set_user">
    <div><mt-cell title="手机号码">
        <span>{{getPhone}}</span>
      </mt-cell></div>
      <div><mt-cell title="密码管理"
        to='/password'
        is-link>
      </mt-cell></div>
      <div><mt-cell title="钱包地址"
        to='/address'
        is-link>
      </mt-cell></div>
</div>
<div class="set_list">
      <div>
        <mt-cell title="用户协议"
        to="/risk"
        is-link>
      </mt-cell>
      </div>
      <div>
        <mt-cell title="存管协议"
        to="/risk"
        is-link>
      </mt-cell>
      </div>
      <div>
        <mt-cell title="重要提示和风险揭示书"
        to="/risk"
        is-link>
      </mt-cell>
      </div>
     <div>
        <mt-cell title="委托管理协议"
        to="/entrust"
        is-link>
      </mt-cell>
     </div>
     <div>
        <mt-cell title="帮助"
        to="/help"
        is-link>
      </mt-cell>
     </div>
</div>
<button class="loginout themebtn" @click="loginOut">退出登录</button>
</div>
  </div>
</template>
<script>
import { Header, MessageBox } from "mint-ui";
import headerBar from "./main/header";
import { mapState, mapGetters, mapMutations, mapActions } from "vuex";
import util from "../assets/js/util";
export default {
  name: "Set",
  data() {
    return {
      msg: "",
      user: sessionStorage.getItem("user")
        ? JSON.parse(sessionStorage.getItem("user"))
        : {},
      type: "",
      title: "设置",
      left: {
        status: true
      }
    };
  },
  components: {
    headerBar
  },
  computed: {
    ...mapState(["pageInfo"]),
    getPhone() {
      return util.getPhone(this.pageInfo.userinfo.mobilephone);
    }
  },
  methods: {
    loginOut() {
      MessageBox.confirm("确定退出登录吗？").then(action => {
        this.$router.back();
        util.clearLocalStorage();
        this.pageInfo.userinfo = "";
        
      //   var u = navigator.userAgent;
      //   var isAndroid = u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android终端
      //   var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
      //   if (isAndroid) {
      //     	window.bjsLauncher.logoff();
      //   } else if (isiOS) {
      //     	window.location.href = "exit";
      //   } else {
      //   }
      });
    }
  },
  mounted() {
    this.type = this.$route.query.type;
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
@import url("../../static/css/set.css");
</style>
